package com.showsu.editor.config;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

import java.util.concurrent.Executor;

@Configuration
@EnableAsync
public class SpringAsyncConfig {

    @Bean("checkAwemeIncludedExecutor")
    public Executor checkRankingExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(2);
        executor.setMaxPoolSize(2048);
        executor.setQueueCapacity(500);
        executor.setThreadNamePrefix("checkAwemeIncludedAsync-");
        executor.initialize();
        return executor;
    }
}
